package com.huage_03;

import java.util.Scanner;

public class UersLoading {
    public static void main(String[] args) {
        String u = "HuaGe";
        String p = "123456";

        Scanner sc = new Scanner(System.in);
        String user;
        String password;
        for (int i=0;i<3;i++){
            System.out.println("请输入用户名：");
            user = sc.nextLine();
            System.out.println("请输入密码：");
            password = sc.nextLine();
            if(user.equals(u) && password.equals(p)){
                System.out.println("登录成功");
                break;
            }else if (!user.equals(u)) {
                System.out.println("登录失败");
                System.out.println("无此用户");
            }else {
                System.out.println("登录失败");
                System.out.println("密码错误");
            }
            if(i==2){
                System.out.println("账号已锁定，请联系管理员");
            }else {
                System.out.println("你还有"+(2-i)+"次机会尝试登录");
            }
        }
    }
}
